{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "         data  value      gain setting       score\n",
      "0  2016-01-01    0.0  0.318930  Medium  100.394126\n",
      "1  2016-01-02    1.0  0.987923  Medium   99.890296\n",
      "2  2016-01-03    2.0  0.626676  Medium  109.090940\n",
      "3  2016-01-04    3.0  0.847561     Low   86.248348\n",
      "4  2016-01-05    4.0  0.624554    High   96.789166\n",
      "5  2016-01-06    5.0  0.611257  Medium   97.126857\n",
      "6  2016-01-07    6.0  0.375337     Low   93.603080\n",
      "7  2016-01-08    7.0  0.039035  Medium   84.117677\n",
      "8  2016-01-09    8.0  0.603805    High   95.277097\n",
      "9  2016-01-10    9.0  0.402418  Medium   86.318551\n",
      "10 2016-01-11   10.0  0.913764     Low  104.199146\n",
      "11 2016-01-12   11.0  0.474602     Low   87.263734\n",
      "12 2016-01-13   12.0  0.239105  Medium   95.279986\n",
      "13 2016-01-14   13.0  0.186489     Low  110.431560\n",
      "14 2016-01-15   14.0  0.882338  Medium  100.238619\n",
      "15 2016-01-16   15.0  0.884605    High  103.325575\n",
      "16 2016-01-17   16.0  0.492989     Low   91.678139\n",
      "17 2016-01-18   17.0  0.383566     Low   83.817652\n",
      "18 2016-01-19   18.0  0.360278    High   85.681079\n",
      "19 2016-01-20   19.0  0.945464    High  123.755510\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "N=20\n",
    "df = pd.DataFrame({\n",
    "   'data': pd.date_range(start='2016-01-01',periods=N,freq='D'),\n",
    "   'value': np.linspace(0,stop=N-1,num=N),\n",
    "   'gain': np.random.rand(N),\n",
    "   'setting': np.random.choice(['Low','Medium','High'],N).tolist(),\n",
    "   'score': np.random.normal(100, 10, size=(N)).tolist()\n",
    "   })\n",
    "print(df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "data\n",
      "value\n",
      "gain\n",
      "setting\n",
      "score\n"
     ]
    }
   ],
   "source": [
    "for col in df:\n",
    "    print(col)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "---------------------------------------------------\n",
      "data\n",
      "---------------------------------------------------\n",
      "0    2016-01-01\n",
      "1    2016-01-02\n",
      "2    2016-01-03\n",
      "3    2016-01-04\n",
      "4    2016-01-05\n",
      "5    2016-01-06\n",
      "6    2016-01-07\n",
      "7    2016-01-08\n",
      "8    2016-01-09\n",
      "9    2016-01-10\n",
      "10   2016-01-11\n",
      "11   2016-01-12\n",
      "12   2016-01-13\n",
      "13   2016-01-14\n",
      "14   2016-01-15\n",
      "15   2016-01-16\n",
      "16   2016-01-17\n",
      "17   2016-01-18\n",
      "18   2016-01-19\n",
      "19   2016-01-20\n",
      "Name: data, dtype: datetime64[ns]\n",
      "---------------------------------------------------\n",
      "value\n",
      "---------------------------------------------------\n",
      "0      0.0\n",
      "1      1.0\n",
      "2      2.0\n",
      "3      3.0\n",
      "4      4.0\n",
      "5      5.0\n",
      "6      6.0\n",
      "7      7.0\n",
      "8      8.0\n",
      "9      9.0\n",
      "10    10.0\n",
      "11    11.0\n",
      "12    12.0\n",
      "13    13.0\n",
      "14    14.0\n",
      "15    15.0\n",
      "16    16.0\n",
      "17    17.0\n",
      "18    18.0\n",
      "19    19.0\n",
      "Name: value, dtype: float64\n",
      "---------------------------------------------------\n",
      "gain\n",
      "---------------------------------------------------\n",
      "0     0.318930\n",
      "1     0.987923\n",
      "2     0.626676\n",
      "3     0.847561\n",
      "4     0.624554\n",
      "5     0.611257\n",
      "6     0.375337\n",
      "7     0.039035\n",
      "8     0.603805\n",
      "9     0.402418\n",
      "10    0.913764\n",
      "11    0.474602\n",
      "12    0.239105\n",
      "13    0.186489\n",
      "14    0.882338\n",
      "15    0.884605\n",
      "16    0.492989\n",
      "17    0.383566\n",
      "18    0.360278\n",
      "19    0.945464\n",
      "Name: gain, dtype: float64\n",
      "---------------------------------------------------\n",
      "setting\n",
      "---------------------------------------------------\n",
      "0     Medium\n",
      "1     Medium\n",
      "2     Medium\n",
      "3        Low\n",
      "4       High\n",
      "5     Medium\n",
      "6        Low\n",
      "7     Medium\n",
      "8       High\n",
      "9     Medium\n",
      "10       Low\n",
      "11       Low\n",
      "12    Medium\n",
      "13       Low\n",
      "14    Medium\n",
      "15      High\n",
      "16       Low\n",
      "17       Low\n",
      "18      High\n",
      "19      High\n",
      "Name: setting, dtype: object\n",
      "---------------------------------------------------\n",
      "score\n",
      "---------------------------------------------------\n",
      "0     100.394126\n",
      "1      99.890296\n",
      "2     109.090940\n",
      "3      86.248348\n",
      "4      96.789166\n",
      "5      97.126857\n",
      "6      93.603080\n",
      "7      84.117677\n",
      "8      95.277097\n",
      "9      86.318551\n",
      "10    104.199146\n",
      "11     87.263734\n",
      "12     95.279986\n",
      "13    110.431560\n",
      "14    100.238619\n",
      "15    103.325575\n",
      "16     91.678139\n",
      "17     83.817652\n",
      "18     85.681079\n",
      "19    123.755510\n",
      "Name: score, dtype: float64\n"
     ]
    }
   ],
   "source": [
    "for key, value in df.iteritems():\n",
    "    print(\"---------------------------------------------------\")\n",
    "    print(key)\n",
    "    print(\"---------------------------------------------------\")\n",
    "    print(value)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0 data       2016-01-01 00:00:00\n",
      "value                        0\n",
      "gain                   0.31893\n",
      "setting                 Medium\n",
      "score                  100.394\n",
      "Name: 0, dtype: object\n",
      "1 data       2016-01-02 00:00:00\n",
      "value                        1\n",
      "gain                  0.987923\n",
      "setting                 Medium\n",
      "score                  99.8903\n",
      "Name: 1, dtype: object\n",
      "2 data       2016-01-03 00:00:00\n",
      "value                        2\n",
      "gain                  0.626676\n",
      "setting                 Medium\n",
      "score                  109.091\n",
      "Name: 2, dtype: object\n",
      "3 data       2016-01-04 00:00:00\n",
      "value                        3\n",
      "gain                  0.847561\n",
      "setting                    Low\n",
      "score                  86.2483\n",
      "Name: 3, dtype: object\n",
      "4 data       2016-01-05 00:00:00\n",
      "value                        4\n",
      "gain                  0.624554\n",
      "setting                   High\n",
      "score                  96.7892\n",
      "Name: 4, dtype: object\n",
      "5 data       2016-01-06 00:00:00\n",
      "value                        5\n",
      "gain                  0.611257\n",
      "setting                 Medium\n",
      "score                  97.1269\n",
      "Name: 5, dtype: object\n",
      "6 data       2016-01-07 00:00:00\n",
      "value                        6\n",
      "gain                  0.375337\n",
      "setting                    Low\n",
      "score                  93.6031\n",
      "Name: 6, dtype: object\n",
      "7 data       2016-01-08 00:00:00\n",
      "value                        7\n",
      "gain                 0.0390349\n",
      "setting                 Medium\n",
      "score                  84.1177\n",
      "Name: 7, dtype: object\n",
      "8 data       2016-01-09 00:00:00\n",
      "value                        8\n",
      "gain                  0.603805\n",
      "setting                   High\n",
      "score                  95.2771\n",
      "Name: 8, dtype: object\n",
      "9 data       2016-01-10 00:00:00\n",
      "value                        9\n",
      "gain                  0.402418\n",
      "setting                 Medium\n",
      "score                  86.3186\n",
      "Name: 9, dtype: object\n",
      "10 data       2016-01-11 00:00:00\n",
      "value                       10\n",
      "gain                  0.913764\n",
      "setting                    Low\n",
      "score                  104.199\n",
      "Name: 10, dtype: object\n",
      "11 data       2016-01-12 00:00:00\n",
      "value                       11\n",
      "gain                  0.474602\n",
      "setting                    Low\n",
      "score                  87.2637\n",
      "Name: 11, dtype: object\n",
      "12 data       2016-01-13 00:00:00\n",
      "value                       12\n",
      "gain                  0.239105\n",
      "setting                 Medium\n",
      "score                    95.28\n",
      "Name: 12, dtype: object\n",
      "13 data       2016-01-14 00:00:00\n",
      "value                       13\n",
      "gain                  0.186489\n",
      "setting                    Low\n",
      "score                  110.432\n",
      "Name: 13, dtype: object\n",
      "14 data       2016-01-15 00:00:00\n",
      "value                       14\n",
      "gain                  0.882338\n",
      "setting                 Medium\n",
      "score                  100.239\n",
      "Name: 14, dtype: object\n",
      "15 data       2016-01-16 00:00:00\n",
      "value                       15\n",
      "gain                  0.884605\n",
      "setting                   High\n",
      "score                  103.326\n",
      "Name: 15, dtype: object\n",
      "16 data       2016-01-17 00:00:00\n",
      "value                       16\n",
      "gain                  0.492989\n",
      "setting                    Low\n",
      "score                  91.6781\n",
      "Name: 16, dtype: object\n",
      "17 data       2016-01-18 00:00:00\n",
      "value                       17\n",
      "gain                  0.383566\n",
      "setting                    Low\n",
      "score                  83.8177\n",
      "Name: 17, dtype: object\n",
      "18 data       2016-01-19 00:00:00\n",
      "value                       18\n",
      "gain                  0.360278\n",
      "setting                   High\n",
      "score                  85.6811\n",
      "Name: 18, dtype: object\n",
      "19 data       2016-01-20 00:00:00\n",
      "value                       19\n",
      "gain                  0.945464\n",
      "setting                   High\n",
      "score                  123.756\n",
      "Name: 19, dtype: object\n"
     ]
    }
   ],
   "source": [
    "for row_index,row in df.iterrows():\n",
    "    print(\"--------------------------------------------------\")\n",
    "    print (row_index)\n",
    "    print(\"--------------------------------------------------\")\n",
    "    print(row)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
